<script lang="ts">
import { AiEditor } from '@/components/AIEditor/index'

export default {
  mounted() {
    new AiEditor({
      element: this.$refs.divRef as Element,
      placeholder: '点击输入内容...',
      content: 'AiEditor 是一个面向 AI 的开源富文本编辑器。 ',
      image: {
          uploadUrl: "http://localhost/upload/editor_upload_file",
          uploadFormName: "file"
          //[AlignLeft, AlignCenter, AlignRight, Delete]
          // bubbleMenuEnable:false,
          // bubbleMenuItems: ["AlignLeft", "AlignCenter", "AlignRight", "delete"]
      },
      video: {
          uploadUrl: "http://localhost/upload/editor_upload_file",
          uploadFormName: "file"
      },
      attachment: {
          uploadUrl: "http://localhost/upload/editor_upload_file",
          uploadFormName: "file"
      },
      ai: {
        models: {
            "internlm2.5": {
                "modelType": 'openai',
                "endpoint": '/puyu/api/v1',
                "apiKey": process.env.INTERNLM_TOKEN,
                "model": 'internlm2.5-latest'
            },
            "glm-4": {
                "modelType": 'openai',
                "endpoint": 'https://open.bigmodel.cn/api/paas/v4',
                "apiKey": process.env.CHATGLM_TOKEN,
                "model": 'glm-4-flash'
            }
        },
        images: {
            "stable_diffusion_xl": {
                "imageType": "custom",
                "url": "http://localhost:8000/image/stable_diffusion_xl/generate_image_editor",
                "data": {
                    "response_type": "url"
                }
            }
        },
        menus: [
          {
            icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"></path><path d="M4 18.9997H20V13.9997H22V19.9997C22 20.552 21.5523 20.9997 21 20.9997H3C2.44772 20.9997 2 20.552 2 19.9997V13.9997H4V18.9997ZM16.1716 6.9997L12.2218 3.04996L13.636 1.63574L20 7.9997L13.636 14.3637L12.2218 12.9495L16.1716 8.9997H5V6.9997H16.1716Z"></path></svg>`,
            name: '种草文案生成',
            prompt: '{content}\n\n请根据上述材料生成一段种草文案.',
            text: 'selected'
          }
        ]
      }
    })
  }
}
</script>

<template>
  <div ref="divRef" style="height: 650px; background-color: darkgrey"></div>
</template>
